package com.examsage.examsage.controller;

import com.examsage.examsage.model.SystemUser;
import com.examsage.examsage.model.vo.ResponseVO;
import com.examsage.examsage.service.ISystemUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author examsage
 * @since 2025-07-02
 */
@RestController
@RequestMapping("/api/v1")
public class SystemUserController {

    @Autowired
    private ISystemUserService systemUserService;

    @PostMapping("/login")
    public ResponseVO login(SystemUser systemUser){
        return systemUserService.login(systemUser);
    }

    @PostMapping("/register")
    public ResponseVO register(SystemUser systemUser){
        return systemUserService.register(systemUser);
    }

    @GetMapping("/me")
    public ResponseVO getCurrentUserMsg(){
        return systemUserService.getCurrentUserMsg();
    }

    @PostMapping("/logout")
    public ResponseVO logout(){
        return systemUserService.logout();
    }
}
